home *** CD-ROM | disk | FTP | other *** search
- Path: doc.ic.ac.uk!not-for-mail
- From: mdf@doc.ic.ac.uk (Martin Frost)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: silly c problem
- Date: 2 Feb 1996 13:38:56 -0000
- Organization: Dept. of Computing, Imperial College, University of London, UK.
- Distribution: world
- Message-ID: <4et45g$38c@oak61.doc.ic.ac.uk>
- References: <f2c_9601302132@techtol.magic.mb.ca>
- Reply-To: mdf@doc.ic.ac.uk (Martin Frost)
- NNTP-Posting-Host: oak61.doc.ic.ac.uk
- X-Newsreader: mxrn 6.18-23
-
-
- In article <f2c_9601302132@techtol.magic.mb.ca>, tahir.khawaja@techtol.magic.mb.ca (Tahir Khawaja) writes:
- > printf("You entered %d and %d.\n\n", &num1, &num2);
- ^ ^
- The & operator gives a pointer to the value. This is necessary for scanf
- as it changes the value given, but if you pass it to printf, you will just
- get a big number printed, which is the address of the variable. This is
- occasionally ueful for debugging, but rarely otherwise.
-
- Remove the & in this line and the other one with printf in, and you will be
- OK.
-